<?php

namespace Admin\Controller;
class SystemController extends BaseController {
    public function index(){
        $this->sysConfig = include './Apps/Home/Conf/system.php';
        $this->filter = implode('|', $this->sysConfig['FILTER']);
        $this->display();
    }
    public function editConfig(){
        $path =  './Apps/Home/Conf/system.php';
        $config = include $path;
        $config['WEBNAME'] = I('post.webname');
        $config['COPY'] = I('post.copy');
        $config['REGIS_ON'] = I('post.regisOn');
        $config['FILTER'] = explode('|', I('post.keyfilter'));
        $data = "<?php\r\nreturn " . var_export($config, true) . ";\r\n?>";
        if (file_put_contents($path, $data)) {
            $this->ajaxReturn(array("msg"=>"操作成功","errorCode"=>0),'JSON');
        } else {
            $this->ajaxReturn(array("msg"=>"操作失败","errorCode"=>1),'JSON');
        }

    }
}
?>